package edu.pku.sei.act.images;

import java.util.Hashtable;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

public class ArchiModelImageProvider {

	static private Hashtable<String, Image> imagesTable = new Hashtable<String, Image>();

	public static final String MOTE = "Mote.png";
	public static final String MOTELARGE = "MoteLarge.png";
	public static final String DATA = "Data.png";
	public static final String DATALARGE = "DataLarge.png";
    public static final String RADIO = "Radio.jpg";
    public static final String RADIOLARGE = "RadioLarge.jpg";
    public static final String TIMER = "Timer.jpg";
    public static final String TIMERLARGE = "TimerLarge.jpg";
    public static final String SIMPLEDEVICE = "SimpleDevice.png";
    public static final String SIMPLEDEVICELARGE = "SimpleDeviceLarge.png";
    public static final String LIP = "LIP.jpg";
    public static final String LIPLARGE = "LIPLarge.jpg";
    public static final String TASK = "Task.jpg";
    public static final String TASKLARGE = "TaskLarge.jpg";
    public static final String PACKAGELARGE = "PackageLarge.jpg";
    public static final String PACKAGE = "Package.png";
	public static final String CODEGEN = "codeGen.gif";
	public static final String INITIALNODE = "InitialNode.png";
	public static final String ACTION = "Action.png";
	public static final String SENDACTION = "SendAction.png";
	public static final String ACCEPTACTION = "AcceptAction.png";
	public static final String DECISIONNODE = "DecisionNode.png";
	public static final String MERGENODE = "MergeNode.png";
	public static final String ACTIVITYFINAL = "ActivityFinal.png";
	public static final String INITIALNODELAEGE = "InitialNodeLarge.png";
	public static final String ACTIONLAEGE = "ActionLarge.png";
	public static final String SENDACTIONLAEGE = "SendActionLarge.png";
	public static final String ACCEPTACTIONLAEGE = "AcceptActionLarge.png";
	public static final String DECISIONNODELAEGE = "DecisionNodeLarge.png";
	public static final String MERGENODELAEGE = "MergeNodeLarge.png";
	public static final String ACTIVITYFINALLAEGE = "ActivityFinalLarge.png";
    
	public static ImageDescriptor getImageDescriptor(String key) {
		return ImageDescriptor.createFromFile(ArchiModelImageProvider.class, key);
	}

	public static Image getImage(final String imageName) {
		Image img = imagesTable.get(imageName);
		if (img != null) {
			return img;
		} else {
			ImageDescriptor imageDescriptor = ArchiModelImageProvider
					.getImageDescriptor(imageName);
			img = imageDescriptor.createImage();
			imagesTable.put(imageName, img);
			return img;
		}
	}
	
}
